package com.object.configuration.utils;

import java.text.DecimalFormat;

/**
 * double的工具类
 */
public class DoubleUtil {

    private static DecimalFormat df = new DecimalFormat("######0.00");

    /**
     * 保留两位小数
     *
     * @param price
     * @return
     */
    public static double twoDecimalPlaces(double price) {
        String format = df.format(price);
        price = Double.parseDouble(format);
        return price;
    }
}
